<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/member_global.css?t={ctime}" rel="stylesheet" type="text/css" />
<link href="../css/member_main_lot_all.css?t={ctime}" rel="stylesheet" type="text/css">
<link href="../css/member_main_lot_b1.css?t={ctime}" rel="stylesheet" type="text/css">
<title>{Title}</title>
<script Language="JavaScript" type="text/javascript" src="/common/betparam/AnimalsParams_{ShowLottoID}.js?t={ctime}"></script>
<script language="JavaScript">
<!--
	var MaxOfJoinNumber 	= {MaxOfJoinNumber};
	var intCNumber = 0;
	var isBTStop7 	= {BTStop7};
	var isBTStop8 	= {BTStop8};
	var isBTStop9 	= {BTStop9};
	var isBTStop10 	= {BTStop10};
	var isBTStop11 	= {BTStop11};

function CleanCheckBox() {
	for (var intN = 1; intN <= 49; intN++) {

		if(document.getElementById("Number" + intN).checked){
			document.getElementById("Number" + intN).checked = false;
			document.getElementById("NoCBox" + intN).style.backgroundColor = document.getElementById("NoCBox" + intN).alt;
			intCNumber--;
		}
	}
	intCNumber = 0;
}
       				

function OpenCheckBox(intBT) {
	NowChoiceNumber = 0;
	document.getElementById("WagerWay0").disabled = false;
	document.getElementById("WagerWay1").disabled = false;

	if (intCNumber < MaxOfJoinNumber) {
   		for (var intN = 1; intN <= 49; intN++) {
       		document.getElementById("Number" + intN).disabled = false;
       	}
       	document.JoinNumber.Submit.disabled	= false;
   		document.JoinNumber.Reset.disabled 	= false;         		
   	}

	if(intBT == 7 || intBT == 8){
		if(document.all)document.getElementById("ChoiceTeam3TR").style.display = "block";
		document.getElementById("ChoiceRadioNo3").disabled = false;
	}else{
		if(document.all)document.getElementById("ChoiceTeam3TR").style.display = "none";
		document.getElementById("ChoiceRadioNo3").disabled = true;
		document.getElementById("ChoiceTNo3").value = "";
	}
	if(document.getElementById("WagerWay1").checked)initailNoTable();

	CleanCheckBox();
}


function ChkChoiceNumber(intNum) {

	if(document.getElementById("Number" + intNum).checked){
		document.getElementById("NoCBox" + intNum).alt = document.getElementById("Number" + intNum).style.background;
		document.getElementById("NoCBox" + intNum).style.background = "#FAB616";
		intCNumber++;
	}else{
		document.getElementById("NoCBox" + intNum).style.background = document.getElementById("NoCBox" + intNum).alt;
		intCNumber--;
	}



	if (intCNumber >= MaxOfJoinNumber) {
		for(var intN = 1; intN <= 49; intN++){
			if(!document.getElementById("Number" + intN).checked){
				document.getElementById("Number" + intN).disabled = true;
			}
		}

	}else{
		for(var intN = 1; intN <= 49; intN++){
			if(!document.getElementById("Number" + intN).checked){
				document.getElementById("Number" + intN).disabled = false;
			}
		}
	}
}


function CheckSubmit(obj) {
	var ChoiceType		= null;

	for (var counter = 0; counter < obj.Bet_Type.length; counter++) {
		if (obj.Bet_Type[counter].checked) {
			ChoiceType = obj.Bet_Type[counter].value;
		}
	}
		
	if (ChoiceType == "7" && intCNumber < 3) {
		window.alert("{AllOfThreeErrMsg}");
		return false;
	} else if (ChoiceType == "8" && intCNumber < 3) {
		window.alert("{TwoOfThreeErrMsg}");
		return false;
	} else if (ChoiceType == "9" && intCNumber < 2) {
		window.alert("{AllOfTwoErrMsg}");
		return false;
	} else if (ChoiceType == "10" && intCNumber < 2) {
		window.alert("{SpecialOfTwoErrMsg}");
		return false;
	} else if (ChoiceType == "11" && intCNumber < 2) {
		window.alert("{SpecialLinkErrMsg}");
		return false;
	} else if (ChoiceType == null) {
		window.alert("{ChoiceTypeErrMsg}");
		return false;
	}
	return true;
}


/**********************************************************************/
var intNowCNo = 1;
var arrNo = new Array(), arrCNoIsOver = new Array();
var BColor_Index = new Array({ColorSet});
var BColor_Value = new Array("red", "blue", "green");
var SpecialOverNumber = "{SpecialOverNumber}" ;

function NumFormat(intNum){
	return (intNum < 10)?("0" + intNum.toString()):intNum.toString();
}

function initailNoTable(){
	var objWTable = document.getElementById("WagerWayTable1"), i = 0, j = 0, intNum = 0, strNum = "";

	with(objWTable)	{
		while(rows.length > 4)	deleteRow(rows.length - 1);
			
		for(i =1; i <= 10; i++)	{
			newTR = insertRow(rows.length);
			newTR.className = (i % 2 == 1)?"mcen":"mcen_ev";
			with(newTR){
				var intCellNo = 0;
				for (j = 0; j <= 4; j++){
					intNum = 10*j + i;
					arrNo[intNum] = 0;
					strNum = NumFormat(intNum);
										

					if (intNum == 50) {
						newTD = insertCell(intCellNo);
						newTD.colSpan = "2";
						newTD.className = "mbline";
						newTD.innerHTML = "&nbsp;";
						intCellNo++;

					}else{
						newTD = insertCell(intCellNo);
						newTD.className = "mcen_ev_th";
						newTD.id = "NoC2Box" + intNum;
						newTD.innerHTML = "<input type='checkbox' name='No"+intNum+"' id='NoID"+intNum+"' value='"+intNum+"' onclick='logCNo("+intNum+", this)'>";
						intCellNo++;

						newTD = insertCell(intCellNo);
						newTD.className = "mbline";
						newTD.id = "NoTip" + intNum;
						newTD.innerHTML = "<b style=\"color:" + BColor_Value[BColor_Index[intNum - 1]] + "\">"+strNum+"</b>";
						intCellNo++;
					}
				}
			}
		}
	}
	arrCNoIsOver = new Array();
	logCNo(0, null);
}

function logCNo(intNo, objNo){
	var intCNo = 0, arrCNo = new Array(), arrIndex = new Array();
	for(var i = 1; i <= 3; i++){
		document.getElementById("ChoiceNo" + i).innerHTML = '&nbsp;';
		arrIndex[i] = -1;
		arrCNo[i] = new Array();
	}
	if(intNo == 0)return;

	if(objNo.checked){
		if(arrNo[intNo] == 0){
			if(arrCNoIsOver[intNowCNo] == 1){
				objNo.checked = false;
			}else{
				arrNo[intNo] = intNowCNo;
			}
		}
	}else{
		arrNo[intNo] = 0;
	}
	for(var i = 1; i < 50; i++){
		intCNo = arrNo[i];
		if(intCNo == 0)continue;
		arrIndex[intCNo]++;
		arrCNoIsOver[intCNo] = (arrIndex[intCNo] >= 11)?1:0;
		arrCNo[intCNo][arrIndex[intCNo]] = NumFormat(i);
	}
	for(var i = 1; i <= 3; i++){
		document.getElementById("ChoiceNo"+i).innerHTML = arrCNo[i].join(",") + '&nbsp;';
		document.getElementById("ChoiceTNo"+i).value = arrCNo[i].join(",");
	}
	return (objNo.checked)?1:0;
}

function ChangeCNo(intCNo){
	intNowCNo = intCNo;

	for(var i = 1; i < 50; i++){
		intCNo = arrNo[i];
		if(intCNo == 0 ||  intCNo == intNowCNo){
			document.getElementById("NoID"+i).disabled = false;
		}else{
			document.getElementById("NoID"+i).disabled = true;
		}
	}
}

function SelectOUOEBall(intOUOE){
	var objGold, intNum = 0;
	var OverNum = eval(SpecialOverNumber);
	
	for(intNum = 1; intNum <= 49; intNum++){
		var strSelectNum = 0;
		switch (intOUOE) {
			case 0: //大單
				if(intNum >= OverNum && intNum % 2 == 1)strSelectNum = intNum;
				break;
			case 1: //大雙
				if(intNum >= OverNum && intNum % 2 == 0)strSelectNum = intNum;
				break;
			case 2: //小單
				if(intNum < OverNum && intNum % 2 == 1)strSelectNum = intNum;
				break;
			case 3: //小雙
				if(intNum < OverNum && intNum % 2 == 0)strSelectNum = intNum;
				break;
		}

		if(strSelectNum > 0){
			objNo = document.getElementById("NoID" + intNum);
			objNo.checked = true;
			if(0 == logCNo(intNum, objNo))return;
		}
	}
}

function SelectANum(intAn){
	if(intAn < 1 || intAn > 12)return;
	var strNum = "", intNum = 0;
	var strAnimals = eval("strAnimals"+intAn.toString());
	
	for(intNum = 1; intNum <= 49; intNum++){
		strNum = NumFormat(intNum);
		if(strAnimals.indexOf(strNum) >= 0){
			objNo = document.getElementById("NoID" + intNum);
			objNo.checked = true;
			if(0 == logCNo(intNum, objNo))return;
		}
	}
}

function SelectMantissa(intMn){
	if(intMn < 0 || intMn > 9)return;
	var strNum = "", intNum = 0;
	
	for(intNum = 1; intNum <= 49; intNum++){
		if(intNum % 10 == intMn){
			objNo = document.getElementById("NoID" + intNum);
			objNo.checked = true;
			if(0 == logCNo(intNum, objNo))return;
		}
	}
}

function ChangeWagerWay(intType){
	switch(intType){
		case 0:
			document.getElementById("WagerWayTable0").style.display = "block";
			document.getElementById("WagerWayTable1").style.display = "none";
			CleanCheckBox();
			break;

		case 1:
			document.getElementById("WagerWayTable0").style.display = "none";
			document.getElementById("WagerWayTable1").style.display = "block";
			initailNoTable();
			break;
	}
}

function CheckWagerWay1Submit() {
	with(document.JoinNumber){
		var intBT = parseInt(Bet_Type.value);
		var j = (intBT == 7 || intBT == 8)?3:2;

		for(var i = 1; i <= j; i++){
			if(document.getElementById("ChoiceTNo"+i).value == ""){
				alert("Plase select number!!");
				return;
			}
		}
		submit();
	}
}

function InitAction(){
	var objWTable = document.getElementById("WagerWayTable0"), i = 0, j = 0, intNum = 0, strNum = "";

	with(objWTable)	{
		while(rows.length > 1)	deleteRow(rows.length - 1);
			
		for(i =1; i <= 10; i++)	{
			newTR = insertRow(rows.length);
			newTR.className = (i % 2 == 1)?"mcen":"mcen_ev";
			with(newTR){
				var intCellNo = 0;
				for (j = 0; j <= 4; j++){
					intNum = 10*j + i;
					arrNo[intNum] = 0;
					strNum = NumFormat(intNum);
										

					if (intNum == 50) {
						newTD = insertCell(intCellNo);
						newTD.colSpan = "2";
						newTD.className = "mbline";
						newTD.innerHTML = "<input type='submit' value='{Submit}' name='Submit' class='zabottonR' disabled>&nbsp;&nbsp;&nbsp;<input name='Reset' type='button' id='Reset' value='{Cancel}' onClick='javascript:CleanCheckBox();'  class='zabotton' disabled>";
						intCellNo++;

					}else{
						newTD = insertCell(intCellNo);
						newTD.className = "mcen_ev_th";
						newTD.id = "NoCBox" + intNum;
						newTD.innerHTML = "<input id='Number"+intNum+"' type='checkbox' name='ChoiceNumber[]' value='"+intNum+"' disabled onClick='ChkChoiceNumber("+intNum+")'  class='zachk'>";
						intCellNo++;

						newTD = insertCell(intCellNo);
						intCellNo++;
						newTD.className = "mbline";
						newTD.id = "NoTip" + intNum;
						newTD.alt =  intNum;
						newTD.innerHTML = "<b style=\"color:" + BColor_Value[BColor_Index[intNum - 1]] + "\">"+strNum+"</b>";
						newTD.onclick = function(){
							LabelForClick(this.alt);
						}
					}
				}
			}
		}
	}
}

function LabelForClick(intNum){
	document.getElementById("Number"+intNum).checked = (document.getElementById("Number"+intNum).checked)?false:true;
	ChkChoiceNumber(intNum);
}
//-->
</script>
</head>

<body onload="InitAction()" oncontextmenu="window.event.returnValue=false" ondragstart="window.event.returnValue=false" onselectstart="event.returnValue=false">

<form name="JoinNumber" method="post" action="./joinnumber_checkout.php" target="leftFrame" onSubmit="javascript:return CheckSubmit(this);">
<input type="hidden" name="sid" value="{ShowSid}">
<input name="LottoID" type="hidden" id="LottoID" value="{ShowLottoID}">
<input name="ChoiceTNo1" type="hidden" id="ChoiceTNo1" value="">
<input name="ChoiceTNo2" type="hidden" id="ChoiceTNo2" value="">
<input name="ChoiceTNo3" type="hidden" id="ChoiceTNo3" value="">

<!--樣式2-->
<div class="topStyle_2">
<table class="mtop" width="725" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td align="center" class="menu_title">{Title}</td>
		<td align="right" valign="top" class="mictxt">{Periods}<em>{ShowSerialNo}</em> ({OpeningDate}{ShowGameDate}&nbsp;{ShowGameTime})</td>
	</tr>
	</table></td>
</tr>
<tr class="menu_tab">
	<td nowrap="nowrap" class="menu_tab" >&nbsp;</td>
</tr>
</table>
</div>

<table width="725" border="0" cellpadding="0" cellspacing="1" class="mbtab_lnu">
<thead>
<tr>
    <td width="110">{Bet_Type}</td>
    <label for="AllOfThree"><td width="123"><input name="Bet_Type" id="AllOfThree" type="radio" value="7" onclick="OpenCheckBox(7);" class="zadot">{AllOfThree}</td></label>
    <label for="TwoOfThree"><td width="123"><input name="Bet_Type" id="TwoOfThree" type="radio" value="8" onclick="OpenCheckBox(8);" class="zadot">{TwoOfThree}</td></label>
    <label for="AllOfTwo"><td width="123"><input name="Bet_Type" id="AllOfTwo" type="radio" value="9" onclick="OpenCheckBox(9);" class="zadot">{AllOfTwo}</td></label>
    <label for="SpecialOfTwo"><td width="123"><input name="Bet_Type" id="SpecialOfTwo" type="radio" value="10" onclick="OpenCheckBox(10);" class="zadot">{SpecialOfTwo}</td></label>
    <label for="SpecialLink"><td width="123"><input name="Bet_Type" id="SpecialLink" type="radio" value="11" onclick="OpenCheckBox(11);" class="zadot">{SpecialLink}</td></label>
</tr>
</thead>
<tr>
	<th>{JoinOdds}</th>
	<label for="AllOfThree"><td id="BTOdds7">{BTOdds7}</td></label>
	<label for="TwoOfThree"><td id="BTOdds8">{BTOdds8}</td></label>
	<label for="AllOfTwo"><td id="BTOdds9">{BTOdds9}</td></label>
	<label for="SpecialOfTwo"><td id="BTOdds10">{BTOdds10}</td></label>
	<label for="SpecialLink"><td id="BTOdds11">{BTOdds11}</td></label>
</tr>
<tr>
	<th>{WagerWay}</th>
	<td colspan="5">
		<label for="WagerWay0"><em style="width:45%"><input name="Number" id="WagerWay0" type="radio" value="0" onclick="ChangeWagerWay(0);" checked disabled>{WWay0}</em></label>
		<label for="WagerWay1"><em style="width:45%"><input name="Number" id="WagerWay1" type="radio" value="1" onclick="ChangeWagerWay(1);" disabled>{WWay1}</em></label>
	</td>
</tr>
</table>

<table width="725" border="0" cellpadding="0" cellspacing="0" class="mbtab" id="WagerWayTable0">
<tr class="mbtitle">
	<td width="11%">&nbsp;</td>
	<td width="9%">{Number}</td>
	<td width="11%">&nbsp;</td>
	<td width="9%">{Number}</td>
	<td width="11%">&nbsp;</td>
	<td width="9%">{Number}</td>
	<td width="11%">&nbsp;</td>
	<td width="9%">{Number}</td>
	<td width="11%">&nbsp;</td>
	<td width="9%">{Number}</td>
</tr>
</table>

<table width="725" border="0" cellpadding="0" cellspacing="0" class="mbtab" id="WagerWayTable1" style="display: none">
<tr class="mcen">
	<th colspan="2" class="mbtitle" style="color:#000000">{ChoiceTeam1} <input type="radio" name="ChoiceTeam" onclick="ChangeCNo(1)" checked></th>
	<td colspan="9" id="ChoiceNo1" class="mbline"  style="text-align: left">&nbsp;</td>
</tr>
<tr class="mcen">
	<th colspan="2" class="mbtitle" style="color:#000000">{ChoiceTeam2} <input type="radio" name="ChoiceTeam" onclick="ChangeCNo(2)"></th>
	<td colspan="9" id="ChoiceNo2" class="mbline"  style="text-align: left">&nbsp;</td>
</tr>
<tr class="mcen" id="ChoiceTeam3TR">
	<th colspan="2" class="mbtitle" style="color:#000000" id="ChoiceTeam3TH">{ChoiceTeam3} <input type="radio" name="ChoiceTeam" onclick="ChangeCNo(3)" id="ChoiceRadioNo3"></th>
	<td colspan="9" id="ChoiceNo3" class="mbline"  style="text-align: left">&nbsp;</td>
</tr>
<tr class="mbtitle">
	<td width="9.5%">&nbsp;</td>
	<td width="8%">{Number}</td>
	<td width="9.5%">&nbsp;</td>
	<td width="8%">{Number}</td>
	<td width="9.5%">&nbsp;</td>
	<td width="8%">{Number}</td>
	<td width="9.5%">&nbsp;</td>
	<td width="8%">{Number}</td>
	<td width="9.5%">&nbsp;</td>
	<td width="8%">{Number}</td>
	<td width="12.5%" class="mbline" rowspan="11" style="background: #FFFFFF;">
				<a href="JavaScript: SelectOUOEBall(0)" class="snq_ouu_tool">{OOdd}</a>&nbsp;
				<a href="JavaScript: SelectOUOEBall(2)" class="snq_ouu_tool">{UOdd}</a><br />
				<a href="JavaScript: SelectOUOEBall(1)" class="snq_ouu_tool">{OEven}</a>&nbsp;
				<a href="JavaScript: SelectOUOEBall(3)" class="snq_ouu_tool">{UEven}</a><br /><br />
				<a href="JavaScript: SelectANum(1)" class="snq_ouu_tool">{An1}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(2)" class="snq_ouu_tool">{An2}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(3)" class="snq_ouu_tool">{An3}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(4)" class="snq_ouu_tool">{An4}</a><br />
				<a href="JavaScript: SelectANum(5)" class="snq_ouu_tool">{An5}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(6)" class="snq_ouu_tool">{An6}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(7)" class="snq_ouu_tool">{An7}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(8)" class="snq_ouu_tool">{An8}</a><br />
				<a href="JavaScript: SelectANum(9)" class="snq_ouu_tool">{An9}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(10)" class="snq_ouu_tool">{An10}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(11)" class="snq_ouu_tool">{An11}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectANum(12)" class="snq_ouu_tool">{An12}</a><br /><br />
				<a href="JavaScript: SelectMantissa(1)" class="snq_ouu_tool">1 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(2)" class="snq_ouu_tool">2 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(3)" class="snq_ouu_tool">3 {Mantissa}</a><br />
				<a href="JavaScript: SelectMantissa(4)" class="snq_ouu_tool">4 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(5)" class="snq_ouu_tool">5 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(6)" class="snq_ouu_tool">6 {Mantissa}</a><br />
				<a href="JavaScript: SelectMantissa(7)" class="snq_ouu_tool">7 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(8)" class="snq_ouu_tool">8 {Mantissa}</a>&nbsp;&nbsp;
				<a href="JavaScript: SelectMantissa(9)" class="snq_ouu_tool">9 {Mantissa}</a><br />
				<a href="JavaScript: SelectMantissa(0)" class="snq_ouu_tool">0 {Mantissa}</a><br /><br />
				<input type="button" value="{Submit}" onclick="CheckWagerWay1Submit()" class='zabottonR'>&nbsp;<input type="button" onclick="initailNoTable()" value="{Cancel}" class='zabotton'>
	</td>
</tr>
</table>

</form>
<script language="JavaScript">
<!--
	if(isBTStop7)document.JoinNumber.Bet_Type[0].disabled = true;
	if(isBTStop8)document.JoinNumber.Bet_Type[1].disabled = true;
	if(isBTStop9)document.JoinNumber.Bet_Type[2].disabled = true;
	if(isBTStop10)document.JoinNumber.Bet_Type[3].disabled = true;
	if(isBTStop11)document.JoinNumber.Bet_Type[4].disabled = true;
//-->
</script>
</body>
</html>
